import { AstContext } from "../../../context";
import { Pages } from "../Pages";
import { R } from "../R";
import { PageVisitor } from "../pageVisitor";

export function parseLiveSlideContainer(visitor: PageVisitor, ast: AutoJs.UiObject, ctx: AstContext) {
    if (ast.visibleToUser()) {
        ctx.set(`currentPage`, Pages.live)
    }
    const sid = ctx.getSid(ast)
    if (sid === R.live_play_root_container) {
        // 老板本手机
        const liveBottomBarSingleIcons = ctx.bfs(ast, it => ctx.isSid(it, 'live_bottom_bar_single_icon_container'))
        if (liveBottomBarSingleIcons.length === 2) {
            ctx.set('toShare', () => {
                const node = liveBottomBarSingleIcons[1]
                node.click()
                node.recycle()
            })
        }
    }
    if (sid === R.live_slide_container) {
        // 新版本手机
    }
    ctx.eachChild(ast, node => {
        visitor.visit(node, ctx)
    })
    return true;
}